
package org.zxy.cxf;

/**
 * Please modify this class to meet your needs
 * This class is not complete
 */

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

import javax.xml.namespace.QName;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * This class was generated by Apache CXF 3.0.4
 * 2015-03-13T00:13:58.229+08:00
 * Generated source version: 3.0.4
 * 
 */
public final class MyService_MyServiceImplPort_Client {

    private static final QName SERVICE_NAME = new QName("http://cxf.zxy.org/", "MyServiceImplService");

    private MyService_MyServiceImplPort_Client() {
    }

    public static void main(String args[]) throws java.lang.Exception {
        URL wsdlURL = MyServiceImplService.WSDL_LOCATION;
        if (args.length > 0 && args[0] != null && !"".equals(args[0])) { 
            File wsdlFile = new File(args[0]);
            try {
                if (wsdlFile.exists()) {
                    wsdlURL = wsdlFile.toURI().toURL();
                } else {
                    wsdlURL = new URL(args[0]);
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }
      
        MyServiceImplService ss = new MyServiceImplService(wsdlURL, SERVICE_NAME);
        MyService port = ss.getMyServiceImplPort();  
        
        {
        System.out.println("Invoking sayHello...");
        System.out.println(port.sayHello("i", "love", "it"));
        }
        {
        System.out.println("Invoking uploadFile...");
        FileType fileType = new FileType();
        InputStream is = new FileInputStream(new File("c:/myservice.wsdl"));
        byte[] content = new byte[is.available()];
        is.read(content);
        fileType.setFileContent(content);
        port.uploadFile(fileType);
        is.close();
        System.out.println("has uploady");
        }
        {
        System.out.println("Invoking getStudentById...");
        IdType idType = new IdType();
        idType.setId(100);
        List<StudentType> array = port.getStudentById(idType).getStudents();
        for (int i = 0; i < array.size(); i++) {
			System.out.println("i--"+array.get(i).getName()+array.get(i).getAddress());
		}
        }
        {
        System.out.println("Invoking showLight...");
        IdType idType = port.showLight(LightType.RED);
        System.out.println(idType.getId());
        }
        {
        System.out.println("Invoking uploadFileByMTOM...");
        DataSource dataSource = new FileDataSource(new File("c:/javaapi.chm"));
        FileMTOMType fileMTOMType = new FileMTOMType();
        fileMTOMType.setFileContent(new DataHandler(dataSource));
        port.uploadFileByMTOM(fileMTOMType);
        }
        {
        System.out.println("Invoking queryByProductName...");
        NameType nameType = new NameType();
        nameType.setName("shengjing");
        OrderType orderType = port.queryByProductName(nameType);
        System.out.println(orderType.getId()+" "+orderType.getOrderName()+" "
        			+orderType.getOrderDate()+" "+orderType.getOwner());
        
        }

        System.exit(0);
    }

}
